{extend name="index/base" /}
{block name="style"}{/block}
{block name="body" }
<blockquote class="layui-elem-quote">
	<a href="javascript:location.reload();" class="layui-btn layui-btn-sm"><i class="layui-icon">&#x1002;</i></a>
	<button url="{:url('del')}" class="layui-btn layui-btn-sm confirm" lay-submit lay-filter="ajax-post"  target-form="ids" >
		<i class="layui-icon">&#xe640;</i> 删除
	</button>
	<button url="{:url('del',['type'=>'all'])}" hide-data="true" lay-submit lay-filter="ajax-post"  class="layui-btn layui-btn-sm layui-btn-danger confirm"><i class="layui-icon">&#x1002;</i>清空商品库</button>
	<form class="layui-form search" action="" style="display: inline-block;float: right;" _lpchecked="1">
		<div class="layui-inline">
			<div class="layui-input-inline" style="width: 120px;">
				<select name="section_id" >
			        <option value="">版块</option>
			        {volist name="sections" id="vo"}
			        <option value="{$key}">{$vo}</option>
			        {/volist}
			    </select>
			</div>
		</div>
		<div class="layui-inline">
			<div class="layui-input-inline">
				<input type="text" name="keyword" placeholder="商品ID/名称" autocomplete="off" class="layui-input">
			</div>
		</div>
		 <div class="layui-inline">
		 	<div class="layui-input-inline">
		 		<button class="layui-btn layui-btn-sm sbtn" lay-submit="" lay-filter="searchsub" id="search"><i class="layui-icon"></i> 搜索</button>
		 	</div>
		 </div>
	</form>
</blockquote>
<table id="tb1" lay-filter="_tb1"></table>
{/block}

{block name="script"}
<script type="text/html" id="check">
	<input type="checkbox" lay-skin="primary" name="ids[]" class="ids" value="{{ d.id }}">
</script>
<script type="text/html" id="bar">
	<a class="layui-btn layui-btn-xs confirm_del" data-url="{:url('del')}?ids={{ d.id }}" >删除</a>
</script>
<script type="text/html" id="pic">
	<img src="{{d.pic}}" width="20" height="20" class="show_img">
</script>
<script type="text/html" id="item_id">
	<span class="layui-text"><a href="https://item.taobao.com/item.htm?id={{d.item_id}}" target="_blank" >{{d.item_id}}</a></span>
</script>
<script>
	layui.config({
		base: '/static/js/',
	});
	layui.use(['tool'], function() {
		var $ = layui.$,layer = layui.layer, form = layui.form,table = layui.table,tool = layui.tool;
		tool.show_img();
		var tableobj = table.render({
			elem:'#tb1',
			url:'{:url('index')}',
			limit:15,
			limits:[10,15,20,50,100],
			page:true,
			//size:'sm',
			method:'get',
			height:'full-100',
			cols:[[
				{title:'<input type=checkbox lay-filter=allChoose lay-skin=primary>',fixed:'left',templet:'#check',width:50},
				{title:'商品ID',field:'item_id',width:150,templet:'#item_id'},
				{title:'分类',field:'section_id_text',width:80},
				{title:'商品名称',field:'title',minWidth:300},
				{title:'图片',field:'pic',templet:'#pic',width:60},
				{title:'视频',field:'video_url',width:80},
				{title:'天猫淘宝',field:'is_tmall_text',width:100},
				{title:'售价',field:'price',width:80},
				{title:'优惠券',field:'quan_price',width:80,style:'color:red'},
				{title:'券后价',field:'price_after_quan',width:80},
				{title:'佣金比例',field:'rate',style:'color:red;',width:100},
				{title:'销量',field:'sales',width:80},
				{title:'结束时间',field:'quan_end_time',width:165},
				{title:'店铺',field:'shop_title',width:100},
				{title:'操作',fixed: 'right', width:80, align:'center', templet: '#bar'}

			]]
		});
		//搜索
		form.on('submit(searchsub)',function(data){
			var fields = $(data.form).serialize();
			tableobj.reload({
				where:data.field
				,page: {curr: 1 }
			});
			return false;
		})


	});
</script>
{/block}
